[Pipe] Fairly limit concurrent TsFile parsers#18260
Open
Caideyipi wants to merge 7 commits into
Open
Conversation
4 tasks
3 tasks
jt2594838
reviewed
Jul 22, 2026
jt2594838
left a comment
Contributor
There was a problem hiding this comment.
The default per-pipe limit may need further discussion.
For single-pipe-multi-region scenario, the performance downgrade may be considerable.
Collaborator
Author
|
Regarding the single-Pipe/multi-region concern: addressed in f75b6c6. The local limit is now scoped by |
jt2594838
approved these changes
Jul 22, 2026
…e-multi-pipe-parser-fairness
…com/Caideyipi/iotdb into fix/pipe-multi-pipe-parser-fairness # Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is the parser admission and fairness part of the Pipe resilience work.
Global and per-Pipe-region limits
pipe_tsfile_parser_in_flight_max_num, defaulting to half of the available processors with a minimum of 1.pipe_tsfile_parser_in_flight_max_num_per_pipe_region, defaulting to 1.pipe_tsfile_parser_memory, the per-Pipe-region limit also provides an approximate parser memory quota.(pipeName, creationTime, dataRegionId), so different regions of one Pipe can parse concurrently while TsFiles from the same Pipe region remain bounded.iotdb-system.properties.templateand support hot reload. Increasing either limit wakes the next eligible queued reservation immediately.Hierarchical fair admission
PipeMemoryManagerschedules waiting requests in three levels:After a Pipe obtains one parser, its remaining requests move behind other waiting Pipes. After a region obtains one parser, its remaining requests move behind other waiting regions of the same Pipe. A multi-region Pipe therefore keeps region parallelism without receiving extra weight in the cross-Pipe fairness queue.
Each TsFile event owns a stable reservation key and carries its stable DataRegion identity through reservation, cancellation, release, and resource finalization. Timeout, explicit close, and resource finalization cancel pending reservations so an abandoned request cannot block a queue head.
Waiting events block on their reservation keys instead of polling every 10 ms. Admission, parser release, request cancellation, memory release, and parser-limit hot reload signal only the next eligible reservation. The signal is retained until consumed, avoiding a lost wake-up between the failed reservation attempt and the wait.
When only hard-threshold memory headroom remains, the selector skips Pipes that already own a parser and admits a waiting Pipe with no parser first.
Diagnostics
An unmatched TsFile parser memory release is treated as an invariant violation and emits a WARN containing the Pipe identity and DataRegion.
Tests
This PR has:
Key changed/added classes
PipeMemoryManagerPipeTsFileInsertionEventPipeMemoryManagerTestPropertiesTest